﻿
@{
    Layout = null;
}
@using Pay.Model.Dto
@using Webdiyer.WebControls.Mvc
@model PagedList<QRCodeOutPut>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="~/Hui/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Hui/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Hui/css/animate.css" rel="stylesheet">
    <link href="~/Hui/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="~/Content/pagerstyles.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Content/layui.css" rel="stylesheet" />
    <script src="~/Hui/js/jquery.min.js?v=2.1.4"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Scripts/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Scripts/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/layer.js"></script>
</head>
<body class="">

    <div id="" class="wrapper wrapper-content animated fadeInRight">
        <div style="margin-bottom:10px;">
            @*<span id="add" onclick="addUser()" class="btn btn-danger">新增用户</span>*@<button type="button" id="loading" class="btn btn-white btn-sm pull-right"><i class="fa fa-refresh"></i> 刷新</button>
        </div>
        @*@using (Ajax.BeginForm("QRCodeList", null, new AjaxOptions { HttpMethod = "post", UpdateTargetId = "articles", InsertionMode = InsertionMode.Replace }, new { id = "search", @class = "form-inline" }))
            {
            <div class="form-group">
                <label for="begin">开始时间:</label>
                <input type="text" class="form-control" id="begin" placeholder="输入开始时间" name="timeBegin">
            </div>
            <div class="form-group">
                <label for="endTime">结束时间:</label>
                <input type="text" class="form-control" id="endTime" placeholder="输入结束时间" name="timeEnd">
            </div>
                <div class="form-group">
                    <label for="userName">关键词:</label>
                    <input type="text" class="form-control" id="SearchWord" placeholder="搜索关键词" name="searchword">
                </div>
                <button type="submit" class="btn btn-primary">搜 索</button>
        }*@
        <div id="articles">
            @Html.Partial("_qrcodeList", Model)
        </div>

    </div>
    @{Html.RegisterMvcPagerScriptResource();}
    <script>
       $("#begin").datetimepicker({
           language: 'zh-CN',
           format: 'yyyy-mm-dd',//显示格式
           todayHighlight: 1,//今天高亮
           minView: "month",//设置只显示到月份
           startView: 2,
           forceParse: 0,
           showMeridian: 1,
           autoclose: 1
       });
       $("#endTime").datetimepicker({
           language: 'zh-CN',
           format: 'yyyy-mm-dd',//显示格式
           todayHighlight: 1,//今天高亮
           minView: "month",//设置只显示到月份
           startView: 2,
           forceParse: 0,
           showMeridian: 1,
           autoclose: 1
       });
       //新增


       $("#loading").click(function () {

           window.location.reload();
       });
       //编辑
       function userEdit(id)
       {
           //var url = '/user/userEdit?userId=' + id;
           //parent.layer.open({
           //    type: 2,
           //    title: '新增用户',
           //    shadeClose: true,
           //    shade: 0.8,
           //    area: ['1200px', '800px'],

           //    content: url
           //});
       }
       //禁用
       function userDel(obj,id)
       {
           parent.layer.confirm('确认要删除吗？', function (index) {
               $.post("/user/userDelete", { userId: id }, function (res) {
                   if (res != null && res.success) {
                       $(obj).parents("tr").remove();

                       //$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                       parent.layer.msg('删除成功', { icon: 5, time: 1000 });
                   } else {
                       parent.layer.msg(res.msg, { icon: 5, time: 1000 });
                   }
               })
           });
       }
       //启用
       function userRestart(obj,id)
       {
           $.post("/user/RestartUser", { userId: id }, function (res) {
               if (res.success) {
                   parent.layer.msg(res.msg);
                   window.location.reload();
                   //$(obj).parent('td').prev().html('<span class="label label-success">已启用</span>');
                   //$(obj).attr('class', 'btn-xs btn-danger').html("停用");
               } else {
                   parent.layer.msg(res.msg);
               }
           })
       }


       /*用户-停用*/
       function member_stop(obj, id) {
           var title = $(obj).attr('title');
           if (title == "停用") {
               parent.layer.confirm('确认要停用吗？', function (index) {
                   $.post("/user/StopUser", { userId: id }, function (res) {
                       if (res != null && res.success) {
                           $(obj).attr('title', '启用')
                           $(obj).parent('td').prev().html('<span class="label label-danger">已停用</span>');
                           $(obj).attr('class', 'btn-xs btn-primary').html("启用");

                           //$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                           parent.layer.msg('已停用!', { icon: 5, time: 1000 });
                       } else {
                           parent.layer.msg(res.msg, { icon: 5, time: 1000 });
                       }
                   })
               });
           } else {
               parent.layer.confirm('确认要启用吗？', function (index) {
                   $.post("/user/RestartUser", { userId: id }, function (res) {
                       if (res != null && res.success) {
                           $(obj).attr('title', '停用')
                           $(obj).parent('td').prev().html('<span class="label label-success">已启用</span>');
                           $(obj).attr('class', 'btn-xs btn-danger').html("停用");

                           //$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');

                           parent.layer.msg('已启用!', { icon: 5, time: 1000 });
                       } else {
                           parent.layer.msg(res.msg, { icon: 5, time: 1000 });
                       }

                   })
               });
           }
       }
       //新增
       function addUser()
       {
           var url = '/user/AddUser?roleType=1&userType=3';
           parent.layer.open({
               type: 2,
               title: '新增用户',
               shadeClose: true,
               shade: 0.8,
               area: ['1200px', '800px'],

               content: url
           });
        }
        //删除
        function Del(obj,id)
        {
            parent.layer.confirm('确认要删除吗？', function (index) {
                $.post("/home/QRCodeDelete", { id: id }, function (res) {
                    if (res != null && res.success) {
                        $(obj).parents("tr").remove();

                        //$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                        parent.layer.msg('删除成功', { icon: 5, time: 1000 });
                    } else {
                        parent.layer.msg(res.msg, { icon: 5, time: 1000 });
                    }
                })
            });
        }
        //上传
        function upload(id, accountName) {
            var url = '/home/uploadimage?accountId=' + id + '&accountName=' + accountName;
            parent.layer.open({
                type: 2,
                title: '上传图片',
                shadeClose: true,
                shade: 0.8,
                area: ['1200px', '800px'],

                content: url
            });
        }
    </script>
</body>

</html>
